package com.ruoyi.system.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.HireHouseMapper;
import com.ruoyi.system.domain.HireHouse;
import com.ruoyi.system.service.IHireHouseService;
import com.ruoyi.common.core.text.Convert;

/**
 * 房源Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-04-26
 */
@Service
public class HireHouseServiceImpl implements IHireHouseService 
{
    @Autowired
    private HireHouseMapper hireHouseMapper;

    /**
     * 查询房源
     * 
     * @param houseId 房源主键
     * @return 房源
     */
    @Override
    public HireHouse selectHireHouseByHouseId(Long houseId)
    {
        return hireHouseMapper.selectHireHouseByHouseId(houseId);
    }

    /**
     * 查询房源列表
     * 
     * @param hireHouse 房源
     * @return 房源
     */
    @Override
    public List<HireHouse> selectHireHouseList(HireHouse hireHouse)
    {
        return hireHouseMapper.selectHireHouseList(hireHouse);
    }

    /**
     * 新增房源
     * 
     * @param hireHouse 房源
     * @return 结果
     */
    @Override
    public int insertHireHouse(HireHouse hireHouse)
    {
        hireHouse.setCreateTime(DateUtils.getNowDate());
        return hireHouseMapper.insertHireHouse(hireHouse);
    }

    /**
     * 修改房源
     * 
     * @param hireHouse 房源
     * @return 结果
     */
    @Override
    public int updateHireHouse(HireHouse hireHouse)
    {
        hireHouse.setUpdateTime(DateUtils.getNowDate());
        return hireHouseMapper.updateHireHouse(hireHouse);
    }

    /**
     * 批量删除房源
     * 
     * @param houseIds 需要删除的房源主键
     * @return 结果
     */
    @Override
    public int deleteHireHouseByHouseIds(String houseIds)
    {
        return hireHouseMapper.deleteHireHouseByHouseIds(Convert.toStrArray(houseIds));
    }

    /**
     * 删除房源信息
     * 
     * @param houseId 房源主键
     * @return 结果
     */
    @Override
    public int deleteHireHouseByHouseId(Long houseId)
    {
        return hireHouseMapper.deleteHireHouseByHouseId(houseId);
    }
}
